<template>
  <li class="setting-list__wider-item">
    <div class="setting"
         :style="{backgroundColor:setting.info.color}"
    >

      <van-popover v-model="showPopover" placement="top-start" trigger="click">
        <div class="setting-intro" style="white-space: pre-line;">
          {{ setting.info.intro }}
        </div>
        <template #reference>
          <div class="setting-icon">
            <i class="iconfont" :class="setting.info.icon||'icon-shezhi-moren'"></i>
          </div>
        </template>
      </van-popover>
      <span class="name" >{{ setting.value }}</span>

    </div>
    <div class="setting-data">
      <div class="setting-name">{{ setting.info.name }}</div>

      <div class="checks">
        <div class="check-list neumorphism"  @click="checkIt('neumorphism')">
          <i class="iconfont icon-dui" v-if="setting.value==='neumorphism'"></i>
        </div>
        <div class="check-list neumorphismU"  @click="checkIt('neumorphismU')">
          <i class="iconfont icon-dui" v-if="setting.value==='neumorphismU'"></i>
        </div>
        <div class="check-list uglyBlue" @click="checkIt('uglyBlue')">
          <i class="iconfont icon-dui" v-if="setting.value==='uglyBlue'"></i>
        </div>
      </div>
    </div>
  </li>
</template>

<script>
import {mapMutations} from "vuex";

export default {
  name: "SettingWiderCell",
  props: {
    setting: {
      type: Object
    },
    li: {
      type: Array
    }
  },
  data() {
    return {
      showPopover: false,
    }
  },
  methods: {
    ...mapMutations(['changeTheme']),
    checkIt(it) {
      this.changeTheme(it);
    }
  },
  mounted() {
  }
}
</script>

<style lang="less">

.setting-intro {
  font-size: 10px;
  border-radius: 20px;
  width: 200px;
  padding: 10px;
  background-color: rgba(255, 255, 255, 0.8);
  opacity: 0.8;
}

.setting-list__wider-item {
  grid-column-start: 1;
  grid-column-end: 4;
  padding: 4px;
  background: var(--background-color);
  box-shadow: var(--box-shadow);

  border-radius: 15px;
  transition: 0.3s;

  .setting {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px;
    color: white;
    background: rgb(69, 72, 86);
    border-radius: 15px;

    .name {
      position: absolute;
      width: 50%;
      left: 25%;
    }


    .setting-icon {
      display: flex;
      justify-content: center;
      align-items: center;
      width: 40px;
      height: 40px;
      background: rgba(255, 255, 255, 0.2);
      border-radius: 10px;

      .iconfont {
        fill: currentcolor;
        width: 18px;
        height: 18px;
      }
    }
  }

  .setting-data {
    display: flex;
    justify-content: space-between;
    padding: 20px 16px 18px 16px;

    .setting-name {
      margin-right: 20px;
      white-space: nowrap;
      padding: 5px;
      font-size: 15px;
      font-weight: 400;
      vertical-align: middle;
      horiz-align: center;
    }

    .checks {
      display: flex;
      align-items: center;
      height: 30px;

      .checked {

      }
    }

    .check-list {
      overflow: hidden;
      position: relative;
      display: flex;
      justify-content: center;
      align-items: center;
      width: 2.5rem;
      height: 2.5rem;
      margin: 0 .8rem;
      color: #fff;
      border-radius: 100%;
      box-shadow: 0 0 16px 0 rgba(0, 0, 0, .2) inset;
      transition: .1s ease-in-out;
    }

    .check-list:hover {
      width: 3rem;
      height: 3rem;
    }

    .check-info {
      position: absolute;
      left: 0;
      font-size: 1.5rem;
      font-weight: 800;
      line-height: 1.7rem;
    }
  }
}

.van-popover__wrapper {
  cursor: pointer;
}

.neumorphism {
  background-color: #b4b4bd;
}

.uglyBlue {
  background-color: rgba(20, 53, 155, 0.8);
}
.neumorphismU{
  background-color: rgba(255, 255, 255, 0.5);
}

.icon-dui {
  color: rgba(67, 53, 53, 0.5);
}
</style>